void setup() {
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  Serial.begin(9600);
}
 
void loop(){
    float pressure = readPressure(A0);
    float millibars = pressure/100;
 
    Serial.println();
    Serial.print("Pressure = ");
    Serial.print(pressure);
    Serial.println(" pascals");
    //Serial.print("Pressure = ");
    //Serial.print(millibars);
    //Serial.println(" millibars");
    delay(250);
    
    if(pressure>=1600){
      digitalWrite(7,HIGH);
    }else{
      digitalWrite(7,LOW);
    }
    
}
/* Reads pressure from the given pin.
* Returns a value in Pascals
*/
float readPressure(int pin){
    int pressureValue = analogRead(pin);
    float pressure=((pressureValue/1024.0)+0.095)/0.00009;
    return pressure;
}
